﻿using CoachingOrganizer.Toolkit.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CoachingOrganizer.Logic.Models.Tools.MoodLevel
{
    public class MoodValueModel
    {
        private DateTime _time;
        private double _value;

        public DateTime Time
        {
            get { return _time; }
            set { _time = value; }
        }

        public double Value
        {
            get { return _value; }
            set { _value = value; }
        }

        internal Func<ActionResult> SaveDelegate;

        public MoodValueModel()
        {

        }

        public async Task<ActionResult> Save()
        {
            Func<ActionResult> saveDelegate = SaveDelegate;
            return saveDelegate == null ? ActionResult.GetErrorResult(new NotSupportedException()) : await Task.Run(() => saveDelegate());
        }
    }
}
